package com.biz.primus.ms.coupon;

import com.biz.primus.ms.coupon.stream.CouponPropertyProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.Message;

/**
 * 优惠券服务
 *
 * @author david-liu
 */
@SpringCloudApplication
@EnableBinding(CouponPropertyProcessor.class)
public class ServiceCouponApplication {

    @Autowired
    private CouponPropertyProcessor couponPropertyProcessor;

    public static void main(String[] args) {
        SpringApplication.run(ServiceCouponApplication.class, args);
    }

    @StreamListener(CouponPropertyProcessor.SYNC_PROPERTY)
    public void syncProperty(Message<String> message) {
        System.out.println(message);
    }
}
